<?php

final class ectools_payment_plugin_offline extends ectools_payment_app implements ectools_interface_payment_app {

    public $name = '线下支付';

    public $app_name = '线下支付接口';

    public $app_key = 'offline';

    public $app_rpc_key = 'offline';

    public $display_name = '线下支付';

    public $curname = 'CNY';

    public $ver = '1.0';

    public $platform = 'iscommon';

    public function __construct($app) {
        parent::__construct($app);
        
        // $this->callback_url = $this->app->base_url(true)."/apps/".basename(dirname(__FILE__))."/".basename(__FILE__);
        $this->callback_url = "";
        $this->submit_url = '';
        $this->submit_method = 'POST';
        $this->submit_charset = 'utf-8';
    }

    public function admin_intro() {
        return app::get('ectools')->_('线下支付后台自定义描述');
    }

    public function intro() {
        return app::get('ectools')->_('线下支付客户自定义描述');
    }

    public function setting() {
        return array(
            'pay_name' => array(
                'title' => app::get('ectools')->_('支付方式名称'),
                'type' => 'string'
            ),
            'order_by' => array(
                'title' => app::get('ectools')->_('排序'),
                'type' => 'string',
                'label' => app::get('ectools')->_('整数值越小,显示越靠前,默认值为1')
            ),
            'support_cur' => array(
                'title' => app::get('ectools')->_('支持币种'),
                'type' => 'text hidden',
                'options' => $this->arrayCurrencyOptions
            ),
            'pay_brief' => array(
                'title' => app::get('ectools')->_('支付方式简介'),
                'type' => 'textarea'
            ),
            'pay_desc' => array(
                'title' => app::get('ectools')->_('描述'),
                'type' => 'html',
                'includeBase' => true
            ),
            'pay_type' => array(
                'title' => app::get('ectools')->_('支付类型(是否在线支付)'),
                'type' => 'hidden',
                'name' => 'pay_type'
            ),
            'status' => array(
                'title' => app::get('ectools')->_('是否开启此支付方式'),
                'type' => 'radio',
                'options' => array(
                    'false' => app::get('ectools')->_('否'),
                    'true' => app::get('ectools')->_('是')
                ),
                'name' => 'status'
            )
        );
    }

    public function dopay($payment) {
        // 线下支付，直接修改支付单据
    }

    public function is_fields_valiad() {
        return true;
    }

    public function callback(&$recv) {}

    public function gen_form() {
        return '';
    }
}
